from abc import ABC, abstractmethod
from datetime import datetime, date
from typing import Dict, List, Optional
from dataclasses import dataclass


@dataclass
class RateData:
    """汇率数据结构"""
    timestamp: datetime
    base: str
    quote: str
    rate: float


class DataSourceProvider(ABC):
    """数据源提供器基类"""
    
    @abstractmethod
    async def get_latest_rates(self, base: str = "JPY", quotes: List[str] = None) -> List[RateData]:
        """获取最新汇率"""
        pass
    
    @abstractmethod
    async def get_historical_rates(
        self, 
        base: str = "JPY", 
        quotes: List[str] = None,
        start_date: date = None,
        end_date: date = None
    ) -> List[RateData]:
        """获取历史汇率"""
        pass
    
    @abstractmethod
    def get_name(self) -> str:
        """获取数据源名称"""
        pass
